<? 
	include("../model/database.php");
	include("../model/xl_tim_dich_vu_dia_diem.php");
	include("../model/xl_binh_luan_dia_diem.php");
	include("../model/xl_hinh_anh_dia_diem.php");
	
	$xl_binh_luan = new xl_binh_luan_dia_diem();
	$xl_hinh_anh = new xl_hinh_anh_dia_diem();
	$xl_tim_kiem = new xl_tim_dich_vu_dia_diem();
	
	$idnhom = $_POST['idnhom'];
	$last_id = $_POST['lastid'];
	$duong=$_POST['duong'];
	
	
	$arrDDNext = $xl_tim_kiem->danhSachTimKiemNhomDuong_ViewMore($duong,$idnhom,$last_id);

	$l = count($arrDDNext);
	$l_p = $arrDDNext[$l-1];
	$id_l = $l_p['MaDiaDiem'];
	
	foreach($arrDDNext as $row){
		$image = $xl_hinh_anh->hinhAnhDiaDiem($row['MaDiaDiem']);
		$hinhdaidien = $image[0]['DuongDan'];
		$sobinhluan = $xl_binh_luan->tong_binh_luan($row['MaDiaDiem']);
?>
    
		<div class="place-item"><!--một địa điểm-->
                	<div class="place-avatar">
                    	<?
							if($hinhdaidien != ''){					
						?>
                        <a href="./?action=dia-diem&idPlace=<?=$row['MaDiaDiem']?>">
                        <img src="uploads/place/<?=$hinhdaidien?>" alt="<?=$row['TenDiaDiem']?>">
                        </a>
						<? } else{?>
                        <a href="./?action=dia-diem&idPlace=<?=$row['MaDiaDiem']?>">
                        	<img src="uploads/place/photo_not_available.png" alt="<?=$row['TenDiaDiem']?>">
                        </a>
                        <? }?>
                    </div>
                    <ul class="place-info">
                    	<li class="first">
                        	<a class="place-title" title="<?=$row['TenDiaDiem']?>" href="./?action=dia-diem&idPlace=<?=$row['MaDiaDiem']?>"><?=$row['TenDiaDiem']?></a>
                        </li>
                        <li>
                        <span class="address-details"><?=$row['DiaChi']?> - <?=$row['TenQuanHuyen']?> - <?=$row['TenTinhThanh']?></span>
                        </li>
                        <li>
                        <img class="icon" title="lượt xem" src="images/icon_views.png">
                        Lượt xem:
                        <span class="page-views"><?= number_format($row['SoLuotXem'],0,',',',')?></span>
                        </li>
                        <li>
                        <img class="icon" title="bình luận" src="images/icon_comment.png">
                        Bình luận:
                        <span class="comment-no"><?=number_format($sobinhluan,0,',',',')?></span>
                        </li>
                        
                    </ul>
                	<div class="clear"></div>
                </div><!--[end] một địa điểm-->
	<?
	}
	if(count($arrDDNext)>=10){
	?>
	<div class="place-item last" id="more<?=$id_l?>"><!--xem thêm-->
     	<input type="hidden" id="idnhom" name="idnhom" value="<?=$l_p['MaNhomDiaDiem']?>" />
        <input type="hidden" id="duong" name="duong" value="<?=$duong?>" />
     	<a id="<?=$id_l?>" class="more">xem thêm</a>
        <div class="clear"></div>                    
     </div><!--[end] xem thêm-->
    <?
	}
    ?>
     <div class="clear"></div>